﻿using System.Web;
using IndoReputation.Models.Constants;

namespace IndoReputation.Models.BusinessObject
{
    public class MySession
    {
        # region Constructor

        #endregion

        #region Properties
        public static int UserID
        {
            get { return HttpContext.Current.Session[IRConstants.SESSION_MY_SESSION_USER_ID] == null ? 0 : (int)HttpContext.Current.Session[IRConstants.SESSION_MY_SESSION_USER_ID]; }
            set 
            {
                HttpContext.Current.Session[IRConstants.SESSION_MY_SESSION_USER_ID] = value;
                //HttpContext.Current.Session.Add(IRConstants.SESSION_MY_SESSION_USER_ID, value);
            }
        }
        public static string LoginName
        {
            get { return HttpContext.Current.Session[IRConstants.SESSION_MY_SESSION_USER_LOGINNAME] == null ? "" : (string)HttpContext.Current.Session[IRConstants.SESSION_MY_SESSION_USER_LOGINNAME]; }
            set { HttpContext.Current.Session[IRConstants.SESSION_MY_SESSION_USER_LOGINNAME] = value; }
        }
        public static string LoginMessage
        {
            get { return (string)HttpContext.Current.Session[IRConstants.SESSION_MY_SESSION_USER_LOGIN_MESSAGE]; }
            set { HttpContext.Current.Session[IRConstants.SESSION_MY_SESSION_USER_LOGIN_MESSAGE] = value; }
        }
        public static string FullName
        {
            get { return HttpContext.Current.Session[IRConstants.SESSION_MY_SESSION_USER_FULL_NAME] == null ? "" : (string)HttpContext.Current.Session[IRConstants.SESSION_MY_SESSION_USER_FULL_NAME]; }
            set { HttpContext.Current.Session[IRConstants.SESSION_MY_SESSION_USER_FULL_NAME] = value; }
        }
        public static bool IsAdmin
        {
            get { return HttpContext.Current.Session[IRConstants.SESSION_MY_SESSION_USER_IS_ADMIN] != null && (bool)HttpContext.Current.Session[IRConstants.SESSION_MY_SESSION_USER_IS_ADMIN]; }
            set { HttpContext.Current.Session[IRConstants.SESSION_MY_SESSION_USER_IS_ADMIN] = value; }
        }
        #endregion
    }
}